<template>
    <van-nav-bar title="积分中心" left-arrow @click-left="onClickLeft" :fixed="true" />
    <div class="vannavbar"></div>
    <div class="pointscenter">
        <div class="box_1 flex-col">
            <div class="group_2 flex-col">
                <div class="section_1 flex-row" @click="goCapitalflow()">
                    <div class="text-wrapper_1 flex-col justify-between">
                        <span class="text_3">团队积分</span>
                        <span class="text_4">{{MemberExt.Wallet4||0}}</span>
                    </div>
                    <!-- <img class="image_2" referrerpolicy="no-referrer"
                        src="https://lanhu.oss-cn-beijing.aliyuncs.com/1feda2dbea760e3812d9942c0e035ee2" /> -->
                    <div class="text-wrapper_1 flex-col justify-between">
                        <span class="text_3">固定消费积分</span>
                        <span class="text_4">{{MemberExt.Wallet5||0}}</span>
                    </div>
                </div>
                <div class="list_1">
                    <div class="list-items_1">
                        <span class="text_7">消费积分</span>
                        <span class="text_8"> {{MemberExt.Wallet1||0}} </span>
                        <div class="text-wrapper_3">
                            <span class="text_9" @click="goRecharge()"> 充值 </span>
                        </div>
                    </div>
                    <div class="list-items_1">
                        <span class="text_7">解冻积分</span>
                        <span class="text_8"> {{MemberExt.Wallet3||0}} </span>
                        <div class="text-wrapper_3">
                            <span class="text_9" @click="goWithdrawal()"> 提现 </span>
                        </div>
                    </div>
                    <div class="list-items_1">
                        <span class="text_7">团队积分</span>
                        <span class="text_8"> {{MemberExt.Wallet4||0}} </span>
                        <div class="text-wrapper_3">
                            <span class="text_9" @click="goWithdrawal()"> 提现 </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { onMounted, reactive, ref, toRefs } from 'vue'
import { Toast, Notify } from 'vant';
import { useStore } from "vuex"; // ⚪️ 引入状态管理
import { useRoute, useRouter } from "vue-router";
import { GetMemberExt } from "@/network/user";
import router from "@/router";
import {
    getToken,
    setToken,
    removeToken
} from "@/utils/auth";
export default {
    setup() {
        const store = useStore(); // 获取对象
        const state = reactive({
            token: store.state.user.token,
            indexofapp: store.state.user.indexofapp,
            constants: {},
            MemberExt:{}
        });
        onMounted(() => {
            init();
        });
        // 初始化信息
        const init = () => {
            // 获取扩展信息
            GetMemberExt({
                Id: state.token.ID
            }).then((res) => {
                if (res.Code == 0) {
                    var data = res.Data;
                    state.MemberExt = data
                }
            });
        };
        const onRefresh = () => {
            init()
            state.isLoading = false
        }
        const goCapitalflow = () => {
            router.push({
                path: "/Capital",
                query: {
                    date: new Date().getTime()
                }
            });
        };
        const goWithdrawal = () => {
            router.push({
                path: "/withdrawal",
                query: {
                    date: new Date().getTime()
                }
            });
        };
        const goRecharge = () => {
            router.push({
                path: "/recharge",
                query: {
                    date: new Date().getTime()
                }
            });
        };
        const onClickLeft = () => {
            router.push({ path: "/my" });
        };
        return {
            ...toRefs(state),
            goCapitalflow,
            goWithdrawal,
            goRecharge,
            onRefresh,
            onClickLeft
        };
    },
};
</script>

<style scoped></style>